t = int(input())
for i in range(t):
    n, m = map(int, input().split())
    arr = map(int, input().split())
    arr = list(arr)
    fm = 1
    for j in range(1, m + 1):
        fm *= j
    an = 1
    head = m - 1
    bottom = 1
    for j in range(bottom, head + 1):
        an *= j
    sum = 0
    for j in arr[m, n]:
        sum += i
    for j in range(m - 1, n):
        sum += arr[m - 1] * (fm / an)

        pass